// JavaScript Document

//导航
$(function(){
	$(".nav .nav_list .nav1:last").css({"margin-right":"0"});
	$(".nav .nav_list .nav1").find("ul li:last").css({"border-bottom":"none"});
	});
$(function(){
	$(".nav .nav_list .nav1").hover(function(){
		$(this).find("ul").stop().slideToggle(300);
		})
	})
	
//banner
$(function(){
	//首页幻灯片
    $('.banner').flexslider({
        animation: "slide",
        slideDirection: "horizontal",   //String: Select the sliding direction, "horizontal" or "vertical"图片设置为滑动式时的滑动方向：左右或者上下
	  slideshow: true,                //Boolean: Animate slider automatically 载入页面时，是否自动播放
	  slideshowSpeed: 5000,           //Integer: Set the speed of the slideshow cycling, in milliseconds 自动播放速度毫秒
	  animationDuration: 600,         //Integer: Set the speed of animations, in milliseconds动画淡入淡出效果延时
	  directionNav: false,             //常用Boolean: Create navigation for previous/next navigation? (true/false)是否显示左右控制按钮
	  controlNav: true,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage是否显示控制菜单
	  keyboardNav: true,              //Boolean: Allow slider navigating via keyboard left/right keys键盘左右方向键控制图片滑动
	  mousewheel: false,              //Boolean: Allow slider navigating via mousewheel鼠标滚轮控制制图片滑动
	  prevText: "Previous",           //String: Set the text for the "previous" directionNav item
	  nextText: "Next",               //String: Set the text for the "next" directionNav item
	  pausePlay: false,               //Boolean: Create pause/play dynamic element
	  pauseText: 'Pause',             //String: Set the text for the "pause" pausePlay item
	  playText: 'Play',               //String: Set the text for the "play" pausePlay item
	  randomize: false,               //Boolean: Randomize slide order 是否随即幻灯片
	  slideToStart: 0,                //Integer: The slide that the slider should start on. Array notation (0 = first slide)初始化第一次显示图片位置
	  animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end 是否循环滚动
	  pauseOnAction: false,            //常用Boolean: Pause the slideshow when interacting with control elements, highly recommended.暂停幻灯片控制元素进行交互时，强烈推荐
	  pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
	  controlsContainer: "",          //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.
	  manualControls: "",             //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.自定义控制导航
	  manualControlEvent:"",          //String:自定义导航控制触发事件:默认是click,可以设定hover
	  start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
	  before: function(s){
		  $(s).fadeTo(500, 1);
		  },           //Callback: function(slider) - Fires asynchronously with each slider animation
	  after: function(s){
		   $(s).fadeTo(500, 1);
		  },            //Callback: function(slider) - Fires after each slider animation completes
	  end: function(){} 
    });
	
	//banner
	$("#banner .banner").hover(function(){
		$('.banner').flexslider('stop');	
		},function(){
			$('#banner .banner').flexslider('play');
			})
});	




//首页投资业务
$(function(){
                var wrap = $("#ipc_wrap");
            var li = $("#ipc_query>li");
            var ge=$("#ipc_query>li").length-1;
            var step = li.outerWidth( true ) * 1;
            var hasAnimate = false;
    
            if ( !wrap.length ) return;
    
            $("#ip_control").on("click", ".ipc_left", function(){
                if ( hasAnimate ) return;
                hasAnimate = true;
    
                wrap.animate({
                    scrollLeft : step
                }, function(){
                    hasAnimate = false;
                    wrap.scrollLeft( 0 )
                    $("#ipc_query>li:lt(1)").appendTo("#ipc_query");
                });
            }).on("click", ".ipc_right", function(){
                if ( hasAnimate ) return;
                hasAnimate = true;
    
                wrap.scrollLeft( step );
                $("#ipc_query>li:lt(-1)").appendTo("#ipc_query");
                
                wrap.animate({
                    scrollLeft : 0
                }, function(){
                    hasAnimate = false;
                });
            });	   
              
     
                })
				
		//fenye
var obj,j;
var page=0;
var nowPage=0;//当前页
var listNum=10;//每页显示<ul>数
var PagesLen;//总页数
var PageNum=5;//分页链接接数(5个)

var obj1,j1;
var page1=0;
var nowPage1=0;//当前页
var listNum1=10;//每页显示<ul>数
var PagesLen1;//总页数
var PageNum1=5;//分页链接接数(5个)

var obj2,j2;
var page2=0;
var nowPage2=0;//当前页
var listNum2=10;//每页显示<ul>数
var PagesLen1;//总页数
var PageNum2=5;//分页链接接数(5个)

var obj3,j3;
var page3=0;
var nowPage3=0;//当前页
var listNum3=10;//每页显示<ul>数
var PagesLen3;//总页数
var PageNum3=5;//分页链接接数(5个)

onload=function(){
obj=document.getElementById("aaa").getElementsByTagName("li");
j=obj.length
PagesLen=Math.ceil(j/listNum);

obj1=document.getElementById("bbb").getElementsByTagName("li");
j1=obj1.length
PagesLen1=Math.ceil(j1/listNum1);

obj2=document.getElementById("ccc").getElementsByTagName("li");
j2=obj2.length
PagesLen2=Math.ceil(j2/listNum2);

obj3=document.getElementById("ddd").getElementsByTagName("li");
j3=obj3.length
PagesLen3=Math.ceil(j3/listNum3);

upPage(0)
upPage1(0)
upPage2(0)
upPage3(0)
}
function upPage(p){
nowPage=p
//内容变换
for (var i=0;i<j;i++){
obj[i].style.display="none"
}
for (var i=p*listNum;i<(p+1)*listNum;i++){
if(obj[i])obj[i].style.display="block"
}
//分页链接变换
strS='<a href="###" onclick="upPage(0)">首页</a>  '
var PageNum_2=PageNum%2==0?Math.ceil(PageNum/2)+1:Math.ceil(PageNum/2)
var PageNum_3=PageNum%2==0?Math.ceil(PageNum/2):Math.ceil(PageNum/2)+1
var strC="",startPage,endPage;
if (PageNum>=PagesLen) {startPage=0;endPage=PagesLen-1}
else if (nowPage<PageNum_2){startPage=0;endPage=PagesLen-1>PageNum?PageNum:PagesLen-1}//首页
else {startPage=nowPage+PageNum_3>=PagesLen?PagesLen-PageNum-1: nowPage-PageNum_2+1;var t=startPage+PageNum;endPage=t>PagesLen?PagesLen-1:t}
for (var i=startPage;i<=endPage;i++){
 if (i==nowPage)strC+='<a href="###" style="color:red;font-weight:700;" onclick="upPage('+i+')">'+(i+1)+'</a> '
 else strC+='<a href="###" onclick="upPage('+i+')">'+(i+1)+'</a> '
}
strE=' <a href="###" onclick="upPage('+(PagesLen-1)+')">尾页</a>  '
strE2=nowPage+1+"/"+PagesLen+"页"+"  共"+j+"条"
if(nowPage == 0){
	strP='<a href="###" onclick="upPage(0)">上一页</a>  '
}else{
	strP='<a href="###" onclick="upPage('+nowPage+-1+')">上一页</a>  '
}
if(nowPage == (PagesLen-1)){
	strN=' <a href="###" onclick="upPage('+(PagesLen-1)+')">下一页</a>  '
}else{
	strN='<a href="###" onclick="upPage('+(nowPage+1)+')">下一页</a>  '
}

document.getElementById("changpage").innerHTML=strS+strP+strC+strN+strE+strE2
}



function upPage1(p){
nowPage1=p
//内容变换
for (var i=0;i<j1;i++){
obj1[i].style.display="none"
}
for (var i=p*listNum1;i<(p+1)*listNum1;i++){
if(obj1[i])obj1[i].style.display="block"
}
//分页链接变换
strS='<a href="###" onclick="upPage1(0)">首页</a>  '
var PageNum_2=PageNum1%2==0?Math.ceil(PageNum1/2)+1:Math.ceil(PageNum1/2)
var PageNum_3=PageNum1%2==0?Math.ceil(PageNum1/2):Math.ceil(PageNum1/2)+1
var strC="",startPage,endPage;
if (PageNum1>=PagesLen1) {startPage=0;endPage=PagesLen1-1}
else if (nowPage1<PageNum_2){startPage=0;endPage=PagesLen1-1>PageNum1?PageNum1:PagesLen1-1}//首页
else {startPage=nowPage1+PageNum_3>=PagesLen1?PagesLen1-PageNum1-1: nowPage1-PageNum_2+1;var t=startPage+PageNum1;endPage=t>PagesLen1?PagesLen1-1:t}
for (var i=startPage;i<=endPage;i++){
 if (i==nowPage1)strC+='<a href="###" style="color:red;font-weight:700;" onclick="upPage1('+i+')">'+(i+1)+'</a> '
 else strC+='<a href="###" onclick="upPage1('+i+')">'+(i+1)+'</a> '
}
strE=' <a href="###" onclick="upPage1('+(PagesLen1-1)+')">尾页</a>  '
strE2=nowPage1+1+"/"+PagesLen1+"页"+"  共"+j1+"条"
if(nowPage1 == 0){
	strP='<a href="###" onclick="upPage1(0)">上一页</a>  '
}else{
	strP='<a href="###" onclick="upPage1('+nowPage1+-1+')">上一页</a>  '
}
if(nowPage1 == (PagesLen1-1)){
	strN=' <a href="###" onclick="upPage1('+(PagesLen1-1)+')">下一页</a>  '
}else{
	strN='<a href="###" onclick="upPage1('+(nowPage1+1)+')">下一页</a>  '
}

if(document.getElementById("changpage1")!=null){
	document.getElementById("changpage1").innerHTML=strS+strP+strC+strN+strE+strE2
}
else{
	return 0
}
}

function upPage2(p){
nowPage2=p
//内容变换
for (var i=0;i<j2;i++){
obj2[i].style.display="none"
}
for (var i=p*listNum2;i<(p+1)*listNum2;i++){
if(obj2[i])obj2[i].style.display="block"
}
//分页链接变换
strS='<a href="###" onclick="upPage2(0)">首页</a>  '
var PageNum_2=PageNum2%2==0?Math.ceil(PageNum2/2)+1:Math.ceil(PageNum2/2)
var PageNum_3=PageNum2%2==0?Math.ceil(PageNum2/2):Math.ceil(PageNum2/2)+1
var strC="",startPage,endPage;
if (PageNum2>=PagesLen2) {startPage=0;endPage=PagesLen2-1}
else if (nowPage2<PageNum_2){startPage=0;endPage=PagesLen2-1>PageNum2?PageNum2:PagesLen2-1}//首页
else {startPage=nowPage2+PageNum_3>=PagesLen2?PagesLen2-PageNum2-1: nowPage2-PageNum_2+1;var t=startPage+PageNum2;endPage=t>PagesLen2?PagesLen2-1:t}
for (var i=startPage;i<=endPage;i++){
 if (i==nowPage2)strC+='<a href="###" style="color:red;font-weight:700;" onclick="upPage2('+i+')">'+(i+1)+'</a> '
 else strC+='<a href="###" onclick="upPage2('+i+')">'+(i+1)+'</a> '
}
strE=' <a href="###" onclick="upPage2('+(PagesLen2-1)+')">尾页</a>  '
strE2=nowPage2+1+"/"+PagesLen2+"页"+"  共"+j2+"条"
if(nowPage2 == 0){
	strP='<a href="###" onclick="upPage2(0)">上一页</a>  '
}else{
	strP='<a href="###" onclick="upPage2('+nowPage2+-1+')">上一页</a>  '
}
if(nowPage2 == (PagesLen2-1)){
	strN=' <a href="###" onclick="upPage2('+(PagesLen2-1)+')">下一页</a>  '
}else{
	strN='<a href="###" onclick="upPage2('+(nowPage2+1)+')">下一页</a>  '
}

if(document.getElementById("changpage2")!=null){
	document.getElementById("changpage2").innerHTML=strS+strP+strC+strN+strE+strE2
}
else{
	return 0
}
}


function upPage3(p){
nowPage3=p
//内容变换
for (var i=0;i<j3;i++){
obj3[i].style.display="none"
}
for (var i=p*listNum3;i<(p+1)*listNum3;i++){
if(obj3[i])obj3[i].style.display="block"
}
//分页链接变换
strS='<a href="###" onclick="upPage3(0)">首页</a>  '
var PageNum_2=PageNum3%2==0?Math.ceil(PageNum3/2)+1:Math.ceil(PageNum3/2)
var PageNum_3=PageNum3%2==0?Math.ceil(PageNum3/2):Math.ceil(PageNum3/2)+1
var strC="",startPage,endPage;
if (PageNum3>=PagesLen3) {startPage=0;endPage=PagesLen3-1}
else if (nowPage3<PageNum_2){startPage=0;endPage=PagesLen3-1>PageNum3?PageNum3:PagesLen3-1}//首页
else {startPage=nowPage3+PageNum_3>=PagesLen3?PagesLen3-PageNum3-1: nowPage3-PageNum_2+1;var t=startPage+PageNum3;endPage=t>PagesLen3?PagesLen3-1:t}
for (var i=startPage;i<=endPage;i++){
 if (i==nowPage3)strC+='<a href="###" style="color:red;font-weight:700;" onclick="upPage3('+i+')">'+(i+1)+'</a> '
 else strC+='<a href="###" onclick="upPage3('+i+')">'+(i+1)+'</a> '
}
strE=' <a href="###" onclick="upPage3('+(PagesLen3-1)+')">尾页</a>  '
strE2=nowPage3+1+"/"+PagesLen3+"页"+"  共"+j3+"条"
if(nowPage3 == 0){
	strP='<a href="###" onclick="upPage3(0)">上一页</a>  '
}else{
	strP='<a href="###" onclick="upPage3('+nowPage3+-1+')">上一页</a>  '
}
if(nowPage3 == (PagesLen3-1)){
	strN=' <a href="###" onclick="upPage3('+(PagesLen3-1)+')">下一页</a>  '
}else{
	strN='<a href="###" onclick="upPage3('+(nowPage3+1)+')">下一页</a>  '
}

if(document.getElementById("changpage3")!=null){
	document.getElementById("changpage3").innerHTML=strS+strP+strC+strN+strE+strE2
}
else{
	return 0
}
}